# GPIOD User Guide This document lists the common gpiod commands for Quectel Pi M1/L1. The checked board uses libgpiod v1.6.3, so this page uses v1 syntax. ## Install and Check ```bash sudo apt update sudo apt install -y gpiod gpiodetect --version gpiodetect gpioinfo ``` | **Command** | **Purpose** | | --- | --- | | `gpiodetect` | View GPIO controllers | | `gpioinfo` | View GPIO line status and usage/ownership | | `gpioget` | Read input state | | `gpioset` | Set output state | | `gpiomon` | Monitor edge events | ## Controller Example ``` gpiochip0 [400000.pinctrl] (114 lines) gpiochip1 [1c40000.qcom,spmi:qcom,pm6125@0] (9 lines) gpiochip2 [soc:spf_core_platform:lpi_pinct] (19 lines) ``` ## Common Commands ```bash # Show main controller lines gpioinfo /dev/gpiochip0 # Read line 36 on gpiochip0 gpioget gpiochip0 36 # Drive high for 5 seconds gpioset --mode=time --sec=5 gpiochip0 36=1 # Monitor rising edge events gpiomon --rising-edge gpiochip0 36 ``` ## Version Difference | **Function** | **Current M1 v1 Syntax** | **Syntax That May Appear in Newer Materials** | | --- | --- | --- | | Read | `gpioget gpiochip0 36` | `gpioget -c gpiochip0 36` | | Output hold | `gpioset --mode=time --sec=5 gpiochip0 36=1` | `gpioset -c gpiochip0 -p 5s 36=1` | | Rising-edge monitoring | `gpiomon --rising-edge gpiochip0 36` | `gpiomon -c gpiochip0 -e rising 36` | ## Notes - GPIO line offset is not the physical header pin number. - Do not control lines marked with `[used]` or an existing consumer. - After `gpioset` exits, output state may return to default; do not rely on residual level.